<!--
wy 购物车页面
描述：显示购物车
最后修改时间：9.16/16:19
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>吃游网-购物车</title>

    <link rel="stylesheet" href="css/quote/bootstrap.css">
    <link rel="stylesheet" href="css/head.css">
    <link rel="stylesheet" href="css/footer.css">
    <link rel="stylesheet" href="css/home/home.css">
    <link rel="stylesheet" href="css/shopcart.css">

    <script src="js/quote/jquery-3.4.1.js"></script>
    <script src="js/quote/hf.js"></script>
    <script src="js/quote/jquery.js"></script>
    <script src="js/quote/bootstrap.js"></script>
    <script src="js/custom.js"></script>
    <link rel="stylesheet" href="css/layui.css">
</head>
<body>
<div class="page-content background body">

    <div class="container">
        <div class="">
            <h3 style="margin: 22px 0">订单详情 </h3>
        </div>
    </div>

    <div class="cart-warp background">
        <div class="w">
            <div id="jd-cart" style="margin-left: -75px;margin-right:  -55px">
                <div class="cart-main cart-main-new">
                    <div class="cart-thead">
                        <div class="column t-checkbox" style="margin-left: 10px">美食图片</div>
                        <div class="column t-goods" style="text-align: center">商品</div>
                        <div class="column t-props">商家</div>
                        <div class="column t-price" style="margin-left: 10px">单价</div>
                        <div class="column t-quantity" style="margin-left: 10px">数量</div>
                        <div class="column t-sum" style="margin-left: -20px">小计</div>
                        <div class="column t-action" style="margin-left: 30px">商品描述</div>
                    </div>
                    <div id="cart-list">
                        <!-- 需要引用的全局信息 -->
                        <div class="cart-item-list" id="cart-item-list-01">
                            <div class="cart-tbody" id="vender_8888">

                                <div class="item-list">

                                    <div class="item-full " id="product_promo_50036182740">





                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>


                <div id="cart-floatbar">
                    <div class="ui-ceilinglamp-1" style="width: 990px; height: 52px;">
                        <div class="cart-toolbar" style="width: 1120px; height: 50px;">
                            <div class="toolbar-wrap">

                                <div class="options-box" style="left: -60px">


                                    <div class="toolbar-right toolbar-right-new">
                                        <div class="normal">
                                            <div class="comm-right">

                                                <div class="btn-area" >
                                 <!--      <a  href="/alipay/payInfo?money=" class="submit-btn" onclick="subm()">立即支付</a>-->
                                                    <button class="submit-btn" onclick="subm()">立即支付</button>
                                                </div>
                                                <div class="price-sum">
                                                    <div>
                                                        <span class="txt txt-new">总价：</span>
                                                        <span class="price sumPrice"></span>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</body>


<script>


    function getQueryVariable(variable) {
        let query = window.location.search.substring(1);
        let vars = query.split("&");
        for (let i = 0; i < vars.length; i++) {
            let pair = vars[i].split("=");
            if (pair[0] == variable) {
                return pair[1];
            }
        }
        return (false);
    }


    /*var search = location.search;

    var orderId = search.split("=")[1];*/

    var orderIsPay=getQueryVariable("orderIsPay")

             var aa
            $.ajax({
                url:"commodity/findCommodityByOrderId1",
                data:{"orderId":getQueryVariable("orderId")},
                async:false,
                success:function (data) {
                    console.log(data)

                    var html=''
                    var total = 0.00;
                    var storeName='';
                    $.each(data,function (index,dom) {
                        total = total + (dom.commodityPrice)*(dom.commodityNumber).toFixed(2)
                        storeName=dom.store.storeName
                        html+='  <div class="  item-last  item-item ">\n' +
                            '                                            <div class="item-form">\n' +
                            '                                                <div class="cell p-goods">\n' +
                            '                                                    <div class="goods-item">\n' +
                            '                                                        <div class="p-img" style="margin-left: -30px">\n' +
                            '                                                            <a href="commodity.html?commodityId='+dom.commodityId+'"><img\n' +
                            '                                                                    src="'+dom.pictureList[0].picture+'" style="width:80px;height:80px"></a>\n' +
                            '                                                        </div>\n' +
                            '                                                        <div class="p-name" style="text-align: center">\n' +
                            '                                                            <a href="commodity.html?commodityId='+dom.commodityId+'">'+dom.commodityName+' </a>\n' +
                            '                                                        </div>\n' +
                            '                                                    </div>\n' +
                            '                                                </div>\n' +
                            '                                                <div class="cell p-props p-props-new">\n' +
                            '                                                    <div class="props-txt" style="margin-left: -20px">'+dom.store.storeName+'</div>\n' +
                            '                                                </div>\n' +
                            '                                                <div class="cell p-price p-price-new">\n' +
                            '                                                    <p class="plus-switch">\n' +
                            '                                                        <strong>¥'+dom.commodityPrice.toFixed(2)+'</strong>\n' +
                            '                                                    </p>\n' +
                            '                                                </div>\n' +
                            '                                                <div class="cell p-quantity" style="text-align: center">\n' +
                            '                                                    <span>'+dom.commodityNumber+'</span>\n' +
                            '                                                </div>\n' +
                            '                                                <div class="cell p-sum">\n' +
                            '                                                    <strong>¥'+(dom.commodityPrice*dom.commodityNumber).toFixed(2)+'</strong>\n' +
                            '\n' +
                            '                                                </div>\n' +
                            '\n' +
                            '                                                <div class="cell p-ops" style="width: 250px">\n' +
                            '                                                    <a href="#" id="remove">'+dom.commodityDescribe+'</a>\n' +
                            '                                                </div>\n' +
                            '                                            </div>\n' +
                            '                                        </div>'

                    })






                    $(".item-full").html(html)
                    /*展示总金额*/
                     if(orderIsPay==1){
                            $(".submit-btn").html("已支付")
                            $(".submit-btn").attr("href","javascript:void(0)")
                         $(".submit-btn").css("background-color","#808080")
                         $(".submit-btn").css("text-decoration","none")
                     }
                    $('.sumPrice').html(`<em id="total">¥` + total.toFixed(2) + `</em>`)
                    aa=total.toFixed(2)
                    bb=storeName

                }

            })



  function subm() {


      window.location.href="/alipay/payInfo?money="+aa+"&storeName="+bb+"&orderId="+getQueryVariable("orderId"); 

  }


</script>



</html>